"use client"
import { UploadOutlined } from '@ant-design/icons';
import type { GetProp,UploadProps,UploadFile } from 'antd';
import { Button, message, Upload,Card,Image  } from 'antd';
import { log } from 'console';
import { useEffect, useState } from "react";

type FileType = Parameters<GetProp<UploadProps, 'beforeUpload'>>[0]
export interface FunctionExpInfo{
    theme:string,
    images:string[],
}
export default function Example ({data}:{data:FunctionExpInfo[]}) {
    const [activeIndex, setActiveIndex] = useState(0);
    const [previewImg, setPreviewImg] = useState<string>();

    useEffect(()=>{
    },[activeIndex])

    /**选择参考图片 */
    const choosImg=(url:string,index:number)=>{
        setActiveIndex(index)
        setPreviewImg(url)
      }

    /**获取file的base64 */
    function getBase64(file: File) {
        return new Promise<string>(async (resolve, reject) => {
            try {
                // 创建FileReader对象
                const reader = new FileReader();
                // 文件读取完成时的回调函数
                reader.onloadend = async function () {
                    resolve(reader.result as string) // 读取完成后的结果为Base64编码的字符串 
                };
                reader.readAsDataURL(file); // 读取文件并将其转换为Base64编码
            } catch (error) {
                reject(error)
            }
        })
    }
    return (
        <div id="part-2" className="w-full flex flex-col justify-center items-center py-[100px] bg-[#f9fafa]">
            <p className="text-[25px]">方案示例</p>
            
        </div>
    )
}